#ifndef __TEST_HPP__
#define __TEST_HPP__

#include <vector>
#include <functional>
#include <string>
#include "../imgui/imgui.h"

namespace opengl_test {
    class Test
    {
    public:
        Test() {}
        virtual ~Test() {}

        virtual void update( float dt ) {}
        virtual void render() {}
        virtual void imGuiRender() {}
    private:

    };


    class TestMenu : public Test {
    public:
        TestMenu( Test*& current )
            :_currentTest( current )
        {}
        ~TestMenu() {}
        void imGuiRender() override {
            for ( auto& test : _tests ) {
                if ( ImGui::Button( test.first.c_str() ) ) {
                    _currentTest = test.second();
                }
            }
        }
        template <typename  T>
        void regTest( std::string const& name ) {
            _tests.push_back( std::make_pair( name, [] () {
                return new T();
            } ) );
        }
    private:
        Test*& _currentTest;
        std::vector < std::pair < std::string, std::function<Test*()> > > _tests;
    };
};

#endif // !__TEST_HPP__
